@svizzle/utils/array-[any-object]

Methods

(static) makeWith(array) → {function}

Source:
Since:
  • 0.2.0
See:

Return a function returning an object by assigning the results of the provided functions assigned to the provided keys.

Example
> makeCircle = makeWith([
	['radius', 'perimeter', 'area'],
	[_.identity, r => 2 * Math.PI * r, r => Math.PI * Math.pow(r, 2)]
])
> makeCircle(3)
{radius: 3, perimeter: 18.85, area: 28.27}
> makeCircle(4)
{radius: 4, perimeter: 25.13, area: 50.27}
Parameters:
Name Type Description
array array

Array of keys and functions arrays

Returns:
  • Any -> Object
Type
function